﻿using Authentication.Data.DataContextStorage;
using Authentication.Model.Model;
using Common.Data.Repository;
using System.Data.Entity;

namespace Authentication.Data.Repository
{
    public class AuthenticationRepository : GenericRepository
    {
        public AuthenticationRepository()
            : base(DataContextFactory.GetDataContext())
        {
        }

        private static AuthenticationRepository _current = null;
        public static AuthenticationRepository Current
        {
            get
            {
                return new AuthenticationRepository();
            }
        }

        public DbSet<Application> Applications
        {
            get
            {
                return ((AuthenticationEntities)this.DbContext).Applications;
            }
        }

        public DbSet<ApplicationObject> Objects
        {
            get
            {
                return ((AuthenticationEntities)this.DbContext).Objects;
            }
        }

        public DbSet<ApplicationGroup> Groups
        {
            get
            {
                return ((AuthenticationEntities)this.DbContext).Groups;
            }
        }

        public DbSet<ApplicationGroupRule> GroupRoles
        {
            get
            {
                return ((AuthenticationEntities)this.DbContext).GroupRules;
            }
        }

        public DbSet<ApplicationAccountRule> AccountRoles
        {
            get
            {
                return ((AuthenticationEntities)this.DbContext).AccountRules;
            }
        }

        public DbSet<Account> Accounts
        {
            get
            {
                return ((AuthenticationEntities)this.DbContext).Accounts;
            }
        }

        public DbSet<ApplicationRule> Roles
        {
            get
            {
                return ((AuthenticationEntities)this.DbContext).Rules;
            }
        }
    }
}
